pp108 : expand Method

expand Method


This method expands the root node or the selected node of the tree by one level.

Syntax

treeID.root.expand()

When called from a node other than root, the syntax is as follows:
treeNode.expand()

Return Value

No return value.

Remarks

The operation should be performed only on a parent tree node item (item with a "+" symbol before it indicating that it can be expanded).

When this function is called, the node is expanded, and any function associated with the onexpand property of the tree item is fired. Once expanded, the tree item has a "-" symbol in place of "+" indicating that it is already expanded.

The expand method is automatically called, and the function associated with onexpand property is also be fired when a tree node is double-clicked.

Example

The following example shows how the above method is used.

//Function called on onselect property of a tree item
function onselectHandler(selectedNode)
{
    //Expand the node
    selectedNode.expand();
}

See Also

tree, onexpand